-- EliteMatchTipsView
-- 精英赛新赛季开始时展示上赛季获得奖励说明

local fileName = string.getModeName(...)
local EliteMatchTipsView = class(fileName, app.mvc.ViewBase)

EliteMatchTipsView.VIEW_ROOT_RES = Res.PvpRewardScene

function EliteMatchTipsView:init()
    self._ui.Button_queding:addClickEventListener(function()
        executeFunc(self._onCloseView)
    end)

    cc.SpriteFrameCache:getInstance():addSpriteFrames('ui_resources/task.plist')
    self._ui["Panel/icon_1/icon"]:loadTexture("ui_resources/task/hero_icon_1.png", 1)
    self._ui.tlt:setString(L("EliteMatchTip38"))
    self._ui.tips_2:setString(L("EliteMatchTip42"))
    self._ui.Button_queding:getChildByName("name"):setString(L("text_10200017"))
    if self._timeline then
        local info = self._timeline:getAnimationInfo("animation")
        self._timeline:gotoFrameAndPause( info.startIndex )
    end
end

function EliteMatchTipsView:refresh()
    if self._data then
        local data = self._data
        local str
        if data.lastLevel == 0 then
            if data.lastRank ~= 0 then
                str = string.format(L("EliteMatchTip41"), data.lastRank)
            else
                str = L("EliteMatchTip31")
            end
        else
            str = string.format(L("EliteMatchTip40"), data.lastLevel)
        end
        self._ui.tips:setString(string.format(L("EliteMatchTip39"), str))
    end
end

return EliteMatchTipsView
